Form = function(el,url,reurl){
	
	_this = this ;
	
	this.el = el ;
	
	this.url = "save.do" ;
	
	this.reurl = "list.do" ;
	
	this.params = {};
	
	this.data = {};
	
	this.setUrl = function(url){
		this.url = url ;
	};
	
	this.setReurl = function(reurl){
		this.reurl = reurl;
	};
	
	//设置参数
	this.setParam = function (param){
		for(var key in param ){
			_this.params[key] = param[key];
		}
	};
	
	//提交表单
	this.submit=function(){
		var inputs = el.find(":input,select");
		inputs.each(function(idx,input){
			_this.params[$(this).attr("name")] = $(this).val();
		});
		
        $.post(_this.url, _this.params,function(data){
        	this.data = data ; 
        	if($.gritter){
	        	$.gritter.add({
					title: '提示信息',
					text: data.msg,
					class_name: 'gritter-' + data.msgType
				});
        	}else{
        		alert(data.msg);
        	}
        	setInterval(function(){
        		window.location.href = _this.reurl ;
        	}, 500);        	
		});
	};
};